package com.example.springboot.controller;

import com.example.springboot.common.Result;
import com.example.springboot.service.ILogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/logs")
public class LogsController {

    @Autowired
    private ILogsService logsService;

    @GetMapping("/selectByPage")
    public Result page(@RequestParam Integer pageNum,
                       @RequestParam Integer pageSize,
                       @RequestParam String type,
                       @RequestParam String username){
        return logsService.pageLogs(pageNum,pageSize,type,username);
    }

    @DeleteMapping("/delete/{id}")
    public Result deleteById(@PathVariable("id") Long id) {
        return logsService.deleteUser(id);
    }

    @DeleteMapping("/delete/batch")
    public Result deleteBatch(@RequestBody List<Long> ids) {
        return logsService.deleteUsers(ids);
    }
}
